
# coding=utf-8

from enum import Enum
from io import StringIO
from typing import List, Tuple


def isArray(s:str) -> bool:
    if s == "DynamicArray":
        return True 
    return False

def isNormal(s:str) -> bool:
    if s != "DynamicArray" and s != "Struct":
        return True
    return False

def isString(s:str) -> bool:
    if s == "string":
        return True
    return False
 
def isStruct(s:str) -> bool:
    if s == "Struct":
        return True
    return False

def parseType(s:str):
    dest_type = ""
    dest_len = 0
    convert_type = ""
    c_type = ""
    if s == "int8" or s == "uint8" or s == "bool":
        dest_type = "int32Values"
        dest_len = 1
        convert_type = "(int32_t)"
        c_type = "int8_t"
    elif s == "int16" or s == "uint16":
        dest_type = "int32Values"
        dest_len = 2
        convert_type = "(int32_t)"
        c_type = "int16_t"
    elif s == "int32" or s == "uint32":
        dest_len = 4
        dest_type="int32Values"
        convert_type = "(int32_t)"
        c_type = "int32_t"
    elif s == "int64" or s == "uint64":
        dest_type = "int64Values"
        dest_len = 8
        convert_type = "(int64_t)"
        c_type = "int64_t"
    elif s == "float":
        dest_type = "floatValues"
        dest_len = 4
        convert_type = "(float)"
        c_type = "float"
    elif s == "double":
        dest_type = "doubleValues"
        dest_len = 8
        convert_type = "(double)"
        c_type = "double"
    else:
        dest_type = "int32Values"
        dest_len = 1
        convert_type = "(int32_t)"
        c_type = "int32_t"

    return dest_type,dest_len,convert_type,c_type
